import Login from "../components/Login"
import Main from "../components/Main"
import NotFound from "../components/404"
import Home from "../components/Main/Home"
import About from "../components/Main/About"

// import { useRoutes } from "react-router-dom";


import { Navigate } from "react-router-dom"

const routes = [
    {
        path: "/login",
        element: <Login />
    },
    {
        path: "/main",
        element: <Main />,
        children: [
            {
                path: "/main/home",
                element: <Home />
            },
            {
                path: "/main/about",
                element: <About />
            }
        ]
    },
    {
        path: "/",
        element: <Navigate to="/login" />
    },
    {
        path: "*",
        element: <NotFound />
    }

]


export default routes

//hooks必须在函数式组件中使用
// export const RenderRoutes = () => {
//     return useRoutes(routes)
// }
